﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WP7DSMClient.Services
{
    /// <summary>
    /// Provides storage facilities for settings.
    /// </summary>
    public interface IStorageSettingsService
    {
        /// <summary>
        /// Update a setting value for our application. If the setting does not
        /// exist, then add the setting.
        /// </summary>
        /// <param name="key">The key to identify the value to store.</param>
        /// <param name="value">The value to store.</param>
        /// <returns><b>true</b> if successfull, <b>false</b> otherwise.</returns>
        bool AddOrUpdateValue(string key, Object value);


        /// <summary>
        /// Get the current value of the setting, or if it is not found, set the 
        /// setting to the default setting.
        /// </summary>
        /// <typeparam name="valueType">The type of the object to retrieve.</typeparam>
        /// <param name="key">The key of the object to retrieve.</param>
        /// <param name="defaultValue">The default value if the key doesn't exist.</param>
        /// <returns>The value retrieved.</returns>
        valueType GetValueOrDefault<valueType>(string key, valueType defaultValue);
        

        /// <summary>
        /// Save the settings.
        /// </summary>
        void Save();
    }
}
